<%@tag language="java" pageEncoding="UTF-8"%>
<%@tag import="org.springframework.web.context.WebApplicationContext"%>
<%@tag import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@tag import="fr.inserm.u915.organifooyi.model.OrganiFooyiDao"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="u" tagdir="/WEB-INF/tags" %>

<%@attribute name="id" required="true" rtexprvalue="true" type="java.lang.Long"%>
<%@attribute name="table" required="true" rtexprvalue="false"%>
<%

  WebApplicationContext context = WebApplicationContextUtils
        .getWebApplicationContext(application);
OrganiFooyiDao dao=context.getBean("organifooyidao",OrganiFooyiDao.class);

getJspContext().setAttribute("postitlist",dao.getPostIts(table,(Long)id));


%>
<c:choose>
<c:when test="${empty  postitlist}">
<i>No Post It.</i>
</c:when>
<c:otherwise>
<c:forEach var="postit" items="${postitlist}">
<div style="${postit.cssStyle}">
${postit.content}<br/>-- Created by <u:user-href id="${postit.createdBy.id}">${postit.createdBy.name}</u:user-href> on <span>${postit.creation}</span>
</div>
</c:forEach>
</c:otherwise>
</c:choose>